﻿using Authority.Model;
using AutoMapper;
using Tool.Model;

namespace Authority.Model
{
    /// <summary>
    /// Admin相关映射
    /// </summary>
    public class AdminProfile : Profile
    {
        public AdminProfile()
        {
            CreateMap<View_SysUserEntity, SysUserInfo>()
                .ForMember(p => p.Code, opt => { opt.MapFrom(t => t.gCode); })
                .ForMember(p => p.LoginName, opt => { opt.MapFrom(t => t.sLoginName); })
                .ForMember(p => p.UserName, opt => { opt.MapFrom(t => t.sUserName); })

                .ForMember(p => p.OrganizationCode, opt => { opt.MapFrom(t => t.iOrganizationCode); })
                .ForMember(p => p.Type, opt => { opt.MapFrom(t => t.iType); })


                .ForMember(p => p.State, opt => { opt.MapFrom(t => t.iState); })
                .ForMember(p => p.Phone, opt => { opt.MapFrom(t => t.sPhone); })
                .ForMember(p => p.Sex, opt => { opt.MapFrom(t => t.iSex); })
                .ForMember(p => p.CreateTime, opt => { opt.MapFrom(t => t.dCreateTime); })
                .ForMember(p => p.RoleCodes, opt => { opt.MapFrom(t => t.sRoleCodes); })
                .ForMember(p => p.RoleNames, opt => { opt.MapFrom(t => t.sRoleNames); })
                .ForMember(p => p.PostCodes, opt => { opt.MapFrom(t => t.sPostCodes); })
                .ForMember(p => p.PostNames, opt => { opt.MapFrom(t => t.sPostNames); })
                .ForMember(p => p.DepartmentCodes, opt => { opt.MapFrom(t => t.sDepartmentCodes); })
                .ForMember(p => p.DepartmentNames, opt => { opt.MapFrom(t => t.sDepartmentNames); })
                .ForMember(p => p.IsSuperAdmin, opt => { opt.MapFrom(t => t.bIsSuperAdmin); })
                .ForMember(p => p.PicUrl, opt => { opt.MapFrom(t => t.sPicUrl); })
                .ForMember(p => p.LockScreenPsw, opt => { opt.MapFrom(t => t.sLockScreenPsw); });


            CreateMap<View_SysUserRoleButtonsEntity,SysUserRoleButtonsInfo>();
            
        }
    }
}
